package com.scvtc.controller.research;

import com.scvtc.domain.ResResult;
import com.scvtc.domain.dto.research.page.ResearchPaperDto;
import com.scvtc.domain.vo.PageVo;
import com.scvtc.domain.vo.research.page.ResearchPaperVo;
import com.scvtc.service.research.ResearchPaperService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 科研刊物信息(ResearchPaper)表控制层
 *
 * @author yiFei
 * @since 2022-06-02 16:17:09
 */
@Api(tags = "科研刊物信息(ResearchPaper)")
@RestController
@RequestMapping("researchPaper")
public class ResearchPaperController {
    /**
     * 科研刊物信息(ResearchPaper)对象
     */
    @Autowired
    private ResearchPaperService researchPaperService;

    @GetMapping("/list")
    @ApiOperation("查询科研刊物信息")
    public ResResult<PageVo<List<ResearchPaperVo>>> getAllResearchPaper(
            @RequestParam(defaultValue = "1") Long current,
            @RequestParam(defaultValue = "10") Long size,
            ResearchPaperVo researchPaperVo) {
        return researchPaperService.getAllResearchPaper(current, size, researchPaperVo);
    }

    @PostMapping("/")
    @ApiOperation("添加单个科研刊物")
    public ResResult<?> addResearchPaper(@RequestBody ResearchPaperDto researchPaperDto) {
        return researchPaperService.addResearchPaper(researchPaperDto);
    }

    @PutMapping("/")
    @ApiOperation("修改单个科研刊物")
    public ResResult<?> updateStudent(@RequestBody ResearchPaperDto researchPaperDto) {
        return researchPaperService.updateResearchPaper(researchPaperDto);
    }

    @DeleteMapping("/")
    @ApiOperation("删除一条科研刊物信息")
    public ResResult<?> deleteResearchPaper(Long id) {
        return researchPaperService.deleteResearchPaper(id);
    }

    @DeleteMapping("/multiple")
    @ApiOperation("删除多条科研刊物信息")
    public ResResult<?> deleteMultipleResearchPaper(Long[] ids) {
        return researchPaperService.deleteMultipleResearchPaper(ids);
    }
}

